package net;

import java.io.IOException;
import java.util.HashMap;

/**
 * Creat by TanLei
 * Description:
 * User:86183
 * Date:2022-06-16
 * Time:13:51
 */
public class TcpDictServer extends TcpThreadPoolEchoServer{
    private HashMap<String,String> dict = new HashMap<>();

    public TcpDictServer(int port) throws IOException {
        super(port);
        dict.put("cat","猫");
        dict.put("dog","狗");
        dict.put("pig","猪");
        dict.put("法大师傅","发射点发");
    }

    @Override
    public String process(String request) {
        return dict.getOrDefault(request,"该词没有找到！");
    }

    public static void main(String[] args) throws IOException {
        TcpDictServer server = new TcpDictServer(9090);
        server.start();
    }
}
